package com.tencreat.service.account.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tencreat.domain.account.AppVersion;
import com.tencreat.mapper.account.AppVersionMapper;
import com.tencreat.service.account.IAppVersionService;
import com.tencreat.common.core.domain.model.ReqIdParam;
import com.tencreat.common.core.domain.model.ReqIdsParam;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author mall
 * @date 2021-11-27
 */
@Service
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements IAppVersionService {


    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public AppVersion selectAppVersionById(ReqIdParam id) {
        return baseMapper.selectById(id.getId());
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param appVersion 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<AppVersion> selectAppVersionList(AppVersion appVersion) {
        return baseMapper.selectList(Wrappers.query(appVersion));
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param appVersion 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertAppVersion(AppVersion appVersion) {
        appVersion.setCreateTime(LocalDateTime.now());
        return baseMapper.insert(appVersion);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param appVersion 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateAppVersion(AppVersion appVersion) {
        appVersion.setUpdateTime(LocalDateTime.now());
        return baseMapper.updateById(appVersion);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteAppVersionByIds(ReqIdsParam ids) {
        return baseMapper.deleteBatchIds(ids.getId());
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteAppVersionById(ReqIdParam id) {
        return baseMapper.deleteById(id.getId());
    }
}
